<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>layuiAdmin pro - 通用后台管理模板系统（单页面专业版）</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="__STATIC__/lib/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="__STATIC__/admin/css/style.css">
    <script src="__STATIC__/lib/layui/layui.js" ></script>
    <script src="__STATIC__/admin/js/jquery-3.3.1.js"></script>
    <link id="layuicss-layuiAdmin" rel="stylesheet" href="__STATIC__/admin/css/admin.css" media="all">
</head>
<body layadmin-themealias="default" class="layui-layout-body" style="">
<div id="LAY_app" class="layadmin-tabspage-none">
    <div class="layui-layout layui-layout-admin">
        <!--头部文件-->
        {include file="common/header"/}
        <!--左侧导航栏-->
        {include file="common/left"/}

        <!-- 主体内容 -->
        <div class="layui-body" id="LAY_app_body">
            <div class="layadmin-tabsbody-item layui-show">
                <div class="layui-card layadmin-header">
                    <div class="layui-breadcrumb" lay-filter="breadcrumb" style="visibility: visible;">
                        <a href="{:url('index/index')}">主页</a><span lay-separator="">/</span>
                        <a><cite>修改密码</cite></a>
                    </div>
                </div>


                <div class="layui-fluid">
                    <div class="layui-card" style="padding-bottom: 20px;padding-top: 20px;">
                        <form class="layui-form" method="" >
                            <div class="layui-form-item">
                                <div class="layui-inline">
                                    <label class="layui-form-label">用户名</label>
                                    <div class="layui-input-inline">
                                        <input type="text" hidden="hidden" name="id" value="{$cur_admin['id']}">
                                        <input type="tel" name="username" readonly lay-verify="required|username" autocomplete="off" class="layui-input" value="{$cur_admin['username']}">
                                    </div>
                                </div>

                            </div>

                            <div class="layui-form-item">
                                <div class="layui-inline">
                                    <label class="layui-form-label">新密码</label>
                                    <div class="layui-input-inline">
                                        <input type="password" name="password" lay-verify="password" autocomplete="off" class="layui-input">
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label">确认新密码</label>
                                    <div class="layui-input-inline">
                                        <input type="password" name="repassword" lay-verify="password" autocomplete="off" class="layui-input">
                                    </div>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <div class="layui-inline">
                                    <label class="layui-form-label">手机号码</label>
                                    <div class="layui-input-inline">
                                        <input type="text" name="phone" lay-verify="phone" autocomplete="off" class="layui-input" value="{$cur_admin['phone']}">
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label">验证邮箱</label>
                                    <div class="layui-input-inline">
                                        <input type="text" name="email" lay-verify="email" autocomplete="off" class="layui-input" value="{$cur_admin['email']}">
                                    </div>
                                </div>
                            </div>

                            <div class="layui-form-item">
                                <div class="layui-input-block">
                                    <button class="layui-btn" lay-submit="" lay-filter="sub">提交</button>
                                    <a class="layui-btn layui-btn-primary" href="{:url('index/index')}">返回主页</a>
                                </div>
                            </div>

                        </form>
                    </div>


                </div>

            </div>
        </div>


    </div>
</div>


</body>

<script>
    $(function () {
        layui.use('form',function () {
            var form=layui.form,layer=layui.layer;
            form.render();
            form.on("submit(sub)",function (data) {
                //验证两次密码输入是否一致
                if(data.field.password!=data.field.repassword){
                    layer.msg('两次密码输入不一致，请重新输入',{icon:5,time:1800});
                    return false;
                }
                $.post("{:url('edit')}",data.field,function (res) {
                    if(res.code==1){
                        layer.msg(res.msg,{icon:1,time:1800});
                        setTimeout(function () {
                            window.location.href="{:url('index/index')}";
                        },1500);
                    }else {
                        layer.msg(res.msg,{icon:5,time:1800});
                    }


                    return false;
                });
                return false;
            });

            return false;



        });
    });



</script>


</html>